db = db.getSiblingDB("db_5ss_acc");

// 1
db.createCollection("ac_userstatstic", {
  validator: {
    $jsonSchema: {
      bsonType: "object",
      required: ["_id"],
      properties: {
        _id: { bsonType: "objectId", description: "primary ID" }
      }
    }
  }
});


// 2
db.createCollection("pcserverinfo", {
  validator: {
    $jsonSchema: {
      bsonType: "object",
      required: ["_id"],
      properties: {
        _id: { bsonType: "objectId", description: "primary ID" }
      }
    }
  }
});


// 3
db.createCollection("roleinfo_xiyou", {
  validator: {
    $jsonSchema: {
      bsonType: "object",
      required: ["_id", "key"],
      properties: {
        _id: { bsonType: "objectId", description: "primary ID" },
        key: { bsonType: "string", description: "key" }
      }
    }
  }
});
db.roleinfo_xiyou.createIndex({ key: 1 }, { unique: true });

// 3
db.createCollection("serverinfo", {
  validator: {
    $jsonSchema: {
      bsonType: "object",
      required: ["_id"],
      properties: {
        _id: { bsonType: "objectId", description: "primary ID" }
      }
    }
  }
});


// 5
db.createCollection("welfarekey_0", {
  validator: {
    $jsonSchema: {
      bsonType: "object",
      required: ["_id", "key"],
      properties: {
        _id: { bsonType: "objectId", description: "primary ID" },
        key: { bsonType: "string", description: "key" }
      }
    }
  }
});
db.welfarekey_0.createIndex({ key: 1 }, { unique: true });


// 6  todo 表明可能错误
db.createCollection("acccount_xiyou", {
  validator: {
    $jsonSchema: {
      bsonType: "object",
      required: ["_id", "key", "aclstlgnt", "acregt", , "acchnl", "actype", "acpid", "pwd"],
      properties: {
        _id: { bsonType: "objectId", description: "primary ID" },
        acpid: { bsonType: "string", description: "账户唯一标识" },
        key: { bsonType: "string", description: "账户唯一键" },
        acchnl: { bsonType: "string", description: "渠道 ID" },
        actype: { bsonType: "string", description: "账户类型" },
        acregt: { bsonType: "int", description: "注册时间时间戳" },
        aclstlgnt: { bsonType: "int", description: "最后登录时间时间戳" },
        pwd: { bsonType: "string", description: "密码" }
      }
    }
  }
});
db.acccount_xiyou.createIndex({ acpid: 1 }, { unique: true });
db.acccount_xiyou.createIndex({ key: 1 });
